﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
using Model;
using System.Data.SqlClient;

namespace BLL
{
    public class FloorsBLL
    {
        FloorsDAL dal = new FloorsDAL();

        /// <summary>
        /// 显示楼状况
        /// </summary>
        /// <returns></returns>
        public List<Floors> ShowFloors()
        {
            return dal.Show();
        }

        /// <summary>
        /// 查找对应项目的楼状况信息
        /// </summary>
        /// <returns></returns>
        public List<Floors> ShowFloors(string projectNumber)
        {
            SqlParameter[] sp1 = new SqlParameter[]{
                  new SqlParameter("projectNumber",projectNumber)
            };
            return dal.Show(sp1);
        }

        public List<Floors> PaperFloors(int PageIndex, int PageSize, out int PageCount)
        {
            PageCount = dal.Show().Count();
            return dal.Show().Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList();
        }
        /// <summary>
        /// 添加楼状况
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public bool AddFloors(Floors m)
        {
            return dal.Add(m);
        }
        /// <summary>
        /// 删除楼状况
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public bool DelFloors(Floors m)
        {
            return dal.Del(m);
        }

        /// <summary>
        /// 查询单个楼状况信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Floors BackFloors(int id)
        {
            return dal.Back(id);
        }

        /// <summary>
        /// 修改楼状况信息
        /// </summary>
        /// <param name="m"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool UpdFloors(Floors m, int id)
        {
            return dal.Update(m, id);
        }
    }
}
